package com.itao.poi.tl;

import com.deepoove.poi.XWPFTemplate;
import com.deepoove.poi.util.PoitlIOUtils;
import com.itao.poi.tl.util.ResourceUtil;

import java.io.FileOutputStream;
import java.util.HashMap;

/**
 * @author sjt
 * @Date 2024/10/9 16:00
 */
public class GettingStart {

    public static void main(String[] args) throws Exception {

        XWPFTemplate template = XWPFTemplate.compile(ResourceUtil.getDocxPath("template.docx"))
                .render(new HashMap<String, Object>() {{
                            put("title", "Hi, poi-tl Word模板引擎");
                        }}
                );
        FileOutputStream fos = new FileOutputStream(ResourceUtil.getDocxOutPath("template.docx"));
        template.writeAndClose(fos);
        PoitlIOUtils.closeQuietlyMulti(template, fos);
    }
}
